using System.Data;
using ET;
namespace DAL
{
    public class Inventory_Detail_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Inventory_Detail(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Inventory_Detail_Search");
        }
        public DataTable BindGirdtb_Inventory_Materials(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Inventory_ID", id);
            return cls.GetData("sp_tb_Inventory_Detail_Edit");
        }

        #endregion

        #region Insert
        public bool Inserttb_Inventory_Detail(Inventory_Detail_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Inventory_ID", data.Inventory_ID);
            cls.AddParameter("@Materials_ID", data.Materials_ID);
            cls.AddParameter("@Inventory_Detail_Quality_Voucher", data.Inventory_Detail_Quality_Voucher);
            cls.AddParameter("@Inventory_Detail_Quality_HaveInventory", data.Inventory_Detail_Quality_HaveInventory);
            cls.AddParameter("@Inventory_Detail_Quality", data.Inventory_Detail_Quality);
            cls.AddParameter("@Inventory_Detail_Price", data.Inventory_Detail_Price);
            return cls.ExecuteNonQuery("sp_tb_Inventory_Detail_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Inventory_Detail(Inventory_Detail_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Inventory_Detail_ID", data.Inventory_Detail_ID);
            cls.AddParameter("@Inventory_ID", data.Inventory_ID);
            cls.AddParameter("@Materials_ID", data.Materials_ID);
            cls.AddParameter("@Inventory_Detail_Quality_Voucher", data.Inventory_Detail_Quality_Voucher);
            cls.AddParameter("@Inventory_Detail_Quality_HaveInventory", data.Inventory_Detail_Quality_HaveInventory);
            cls.AddParameter("@Inventory_Detail_Quality", data.Inventory_Detail_Quality);
            cls.AddParameter("@Inventory_Detail_Price", data.Inventory_Detail_Price);
            return cls.ExecuteNonQuery("sp_tb_Inventory_Detail_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Inventory_Detail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Inventory_Detail_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Inventory_Detail_Delete");
        }
        public bool Deletetb_Inventory_Detail_Default_ID(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Inventory_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Inventory_Detail_Delete_Default");
        }
        #endregion

        #region Sum
        public DataTable Sum_Inventory_Detail_Quality_HaveInventory(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Material_ID", id);
            return cls.GetData("sp_tb_Inventory_Detail_Sum_Quality_HaveInventory");
        }
        #endregion
    }
}